local que_xinchuan = fk.CreateSkill {
    name = "que_xinchuan",
    anim_type = "offensive",
    tags = { Skill.Compulsory },
}
Fk:loadTranslationTable {
    ["que_xinchuan"] = "薪传",
    [":que_xinchuan"] = "锁定技，当你受到伤害时，若你的护甲不为0，防止之，失去等量的护甲，获得等量的“薪火”，若薪火因此大于等于你的体力上限，你移去所有“薪火”，弃置X张牌，不足的部分改为失去体力；" ..
        "你的手牌上限、攻击范围额外增加护甲值(X为薪火的数量)。",

    ["@bmw_xinhuo"] = "薪火",

    ["$que_xinchuan1"] = " ",
    ["$que_xinchuan2"] = " ",
}
que_xinchuan:addEffect(fk.DamageInflicted, {
    can_trigger = function(self, event, target, player, data)
        return player:hasSkill(que_xinchuan.name) and target == player and player.shield > 0 and
            player:hasSkill(que_xinchuan.name)
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        room:addPlayerMark(player, "@bmw_xinhuo", data.damage)
        room:addPlayerMark(player, "bmw_xinhuo", data.damage)
        room:changeShield(player, -data.damage)
        data.damage = 0
        if player:getMark("@bmw_xinhuo") >= player.maxHp then
            local n = player:getMark("@bmw_xinhuo")
            local cards = #player:getCardIds("he")
            if cards > n then
                room:askToDiscard(player, {
                    min_num = n,
                    max_num = n,
                    include_equip = true,
                    skill_name = que_xinchuan.name,
                    cancelable = false,
                })
            elseif cards == n then
                player:throwAllCards("he", que_xinchuan.name)
            else
                player:throwAllCards("he", que_xinchuan.name)
                room:loseHp(player, n - cards)
            end
            room:setPlayerMark(player, "@bmw_xinhuo", 0)
        end
    end,
})
que_xinchuan:addEffect("maxcards", {
    correct_func = function(self, player)
        if player:hasSkill(que_xinchuan.name) then
            return player.shield
        else
            return 0
        end
    end,
})
que_xinchuan:addEffect("atkrange", {
    correct_func = function(self, from, to)
        return from.shield
    end,
})
return que_xinchuan
